package Models

import (
	"github.com/jinzhu/gorm"
	"goShopping/superShopping/superShopping/Dao"
)

type User struct {
	gorm.Model
	Uid int `gorm:"PRIMARY_KEY;AUTO_INCREMENT",form:"uid"`
	Username string `gorm:"not null;PRIMARY_KEY",form:"username"`
	Password string `gorm:"not null",form:"password"`
	Iphone string
	Email string
	Area string    	//地区
	UserRole string   //身份
	Money float64
	UserImg string    //头像
}

func CreateUser(user *User)(err error){
	err= Dao.Db.Create(&user).Error
	return err
}

func LoginUser(name string)(user []*User,err error){
		err= Dao.Db.Model(&User{}).Where("Username=?",name).First(&user).Error
		return user,err
}

func OrUser()(user []*User,err error){
	err= Dao.Db.Model(&User{}).Find(&user).Error
	return user, err
}





